import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by leanne on 7/18/14.
 */
public class primefactors {
    public static void main(String args[]) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Please enter a number to find factors for");
        try {
            int input = Integer.parseInt(reader.readLine());
            generate(input);
        } catch(NumberFormatException n) {
            System.out.println("Incorrect format");
        }
    }

    private static void generate(int numToFindFactors) {
        for(int i = 1; i <= numToFindFactors / 2; i++) {
            if(numToFindFactors % i == 0) {
                System.out.print(i + " ");
            }
        }

        // Add the number itself
        System.out.print(numToFindFactors);
    }
}
